package com.example.demo.order.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName OrderModuleConfig
 * @Description 订单模块配置类 - 用于管理模拟实现的开关
 * @Author MingChang.Wei
 * @Date 2025/9/26
 **/
@Configuration
@ConfigurationProperties(prefix = "order.module")
public class OrderModuleConfig {
    
    /**
     * 是否启用模拟支付（生产环境应设为false）
     */
    private boolean mockPayment = true;
    
    /**
     * 是否启用模拟库存验证（生产环境应设为false）
     */
    private boolean mockStock = true;
    
    /**
     * 是否启用模拟商品服务（生产环境应设为false）
     */
    private boolean mockProduct = true;
    
    /**
     * 模拟支付成功率（仅在mockPayment=true时有效）
     */
    private double mockPaymentSuccessRate = 0.95;
    
    /**
     * 模拟库存上限（仅在mockStock=true时有效）
     */
    private int mockStockLimit = 100;
    
    /**
     * 订单超时时间（分钟）
     */
    private int orderTimeoutMinutes = 30;
    
    /**
     * 购物车商品数量上限
     */
    private int cartItemLimit = 100;
    
    // Getters and Setters
    public boolean isMockPayment() {
        return mockPayment;
    }
    
    public void setMockPayment(boolean mockPayment) {
        this.mockPayment = mockPayment;
    }
    
    public boolean isMockStock() {
        return mockStock;
    }
    
    public void setMockStock(boolean mockStock) {
        this.mockStock = mockStock;
    }
    
    public boolean isMockProduct() {
        return mockProduct;
    }
    
    public void setMockProduct(boolean mockProduct) {
        this.mockProduct = mockProduct;
    }
    
    public double getMockPaymentSuccessRate() {
        return mockPaymentSuccessRate;
    }
    
    public void setMockPaymentSuccessRate(double mockPaymentSuccessRate) {
        this.mockPaymentSuccessRate = mockPaymentSuccessRate;
    }
    
    public int getMockStockLimit() {
        return mockStockLimit;
    }
    
    public void setMockStockLimit(int mockStockLimit) {
        this.mockStockLimit = mockStockLimit;
    }
    
    public int getOrderTimeoutMinutes() {
        return orderTimeoutMinutes;
    }
    
    public void setOrderTimeoutMinutes(int orderTimeoutMinutes) {
        this.orderTimeoutMinutes = orderTimeoutMinutes;
    }
    
    public int getCartItemLimit() {
        return cartItemLimit;
    }
    
    public void setCartItemLimit(int cartItemLimit) {
        this.cartItemLimit = cartItemLimit;
    }
}
